/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tpdisenio2009.model.beans;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author DeuterioX
 */
@Entity
@Table(name = "real_team")
@NamedQueries({
    @NamedQuery(name = "RealTeam.findAll", query = "SELECT r FROM RealTeam r")})
public class RealTeam implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;

    @Basic(optional = false)
    @Column(name = "name", nullable=false)
    private String name;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "realTeamLocal")
    private Collection<SoccerMatch> localSoccerMatchCollection;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "realTeamVisitor")
    private Collection<SoccerMatch> visitorSoccerMatchCollection;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "realTeam")
    private Collection<SoccerPlayer> sosserPlayerCollection;

    public RealTeam() {
    }

    public RealTeam(Integer id) {
        this.id = id;
    }

    public RealTeam(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Collection<SoccerMatch> getLocalSoccerMatchCollection() {
        return localSoccerMatchCollection;
    }

    public void setLocalSoccerMatchCollection(Collection<SoccerMatch> soccerMatchCollection) {
        this.localSoccerMatchCollection = soccerMatchCollection;
    }

    public Collection<SoccerMatch> getVisitorSoccerMatchCollection1() {
        return visitorSoccerMatchCollection;
    }

    public void setVisitorSoccerMatchCollection(Collection<SoccerMatch> soccerMatchCollection) {
        this.visitorSoccerMatchCollection = soccerMatchCollection;
    }

    public Collection<SoccerPlayer> getSosserPlayerCollection() {
        return sosserPlayerCollection;
    }

    public void setSosserPlayerCollection(Collection<SoccerPlayer> sosserPlayerCollection) {
        this.sosserPlayerCollection = sosserPlayerCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RealTeam)) {
            return false;
        }
        RealTeam other = (RealTeam) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return name;
    }

}
